<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>${message("用户列表")}</title>
<link href="/resources/css/common.css" rel="stylesheet" type="text/css" />
<link href="/resources/css/zTreeStyle.css" rel="stylesheet"
	type="text/css">
	<link href="/resources/css/layout.css" rel="stylesheet" type="text/css" />
	<link href="/resources/css/mmGrid.css" rel="stylesheet" type="text/css" />
	<script type="text/javascript" src="/resources/js/reference/jquery.js"></script>
	<script type="text/javascript" src="/resources/js/base/dialog.js"></script>
	<script type="text/javascript"
		src="/resources/js/reference/jquery.validate.js"></script>
	<script type="text/javascript" src="/resources/js/base/request.js"></script>
	<script type="text/javascript" src="/resources/js/base/global.js"></script>
	<script type="text/javascript" src="/resources/js/reference/mmGrid.js"></script>
	<script type="text/javascript"
		src="/resources/plugin/datePicker/WdatePicker.js"></script>
	<script type="text/javascript"
		src="/resources/js/reference/jquery.ztree.core-3.5.js"></script>
	<script type="text/javascript">
		function edit(id) {
			parent.change_tab(0, 'edit.jhtml?id=' + id + '&isEdit=${isEdit}&memberType=${memberType}');
		}
		$()
				.ready(
						function() {
							var $buildForm = $("#buildForm");

							var cols = [
									[#if memberType==1]
									{
										title : '${message("操作员PIN码")}',
										name : 'pin_code',
										align : 'center',
										renderer : function(val, item, rowIndex) {
											return '<a href="javascript:void(0);" onClick="edit('
													+ item.id
													+ ')" class="red">'
													+ val
													+ '</a>';
										}
									},
									[#else]
									{
										title : '${message("用户名")}',
										name : 'username',
										align : 'center',
										renderer : function(val, item, rowIndex) {
											return '<a href="javascript:void(0);" onClick="edit('
													+ item.id
													+ ')" class="red">'
													+ val
													+ '</a>';
										}
									},
									{
										title : '${message("手机")}',
										name : 'mobile',
										align : 'center'
									},
									[/#if]
									{
										title : '${message("姓名")}',
										name : 'name',
										align : 'center'
									},
									{
										title : '${message("企业名称")}',
										name : 'company_name',
										align : 'center'
									},
									{
										title : '${message("用户状态")}',
										name : 'is_enabled',
										align : 'center',
										renderer : function(val) {
											if (val == 0) {
												return '<span class="red">${message("禁用")}</span>';
											} else {
												return '<span class="green">${message("正常")}</span>';
											}
										}
									}, ];
							$mmGrid = $('#table-m1').mmGrid({
								autoLoad : true,
								cols : cols,
								fullWidthRows : true,
								url : 'list_data.jhtml',
								params : function() {
									return $("#listForm").serializeObject();
								},
								plugins : [ $('#paginator').mmPaginator() ]
							});
						});

		function member_import(e) {
			excel_import(e, {
				title : '${message("用户导入")}',
				url : 'import_excel.jhtml',
				template : '/resources/template/member/member.xls',
				callback : function() {
					$("#searchBtn").click();

				}
			});
		}

		//条件导出		    
		function segmentedExport(e) {
			var needConditions = true;//至少一个条件
			var page_url = 'to_condition_export.jhtml';//分页导出统计页面
			var url = 'condition_export.jhtml';//导出的方法
			conditions_export(e, {
				needConditions : needConditions,
				page_url : page_url,
				url : url
			});
		}

		//选择导出
		function exportExcel(t) {
			var param = $mmGrid.serializeSelectedIds();//参数
			var tip = '${message("请选择导出的用户！")}';//提示
			var url = 'selected_export.jhtml';//导出的方法
			select_export(t, {
				tip : tip,
				param : param,
				url : url
			});
		}
	</script>
	<script type="text/javascript">
		$().ready(function(e) {
			var zTree = $("#js-menu").initTree({
				url : "/saleOrg/getNodes.jhtml",
				onClick : function(e, treeId, treeNode) {
					$("#saleOrgId").val(treeNode.oid);
					if (treeNode.id == "") {
						$("#saleOrgName").val("");
					} else {
						$("#saleOrgName").val(treeNode.name);
					}
					$("#searchBtn").click();
				},
				onAsyncSuccess: function(e, treeId, treeNode) {
					var rootNodes = zTree.getNodes();
				 	for (var i = 0; i < rootNodes.length; i++) {
				 		zTree.expandNode(rootNodes[i],true,false,false);
				 	}
				}
			})
			zTree.addNodes(null, {
				'id' : '',
				'pId' : '',
				'name' : '全部机构',
				'isParent' : false
			});
		treeScoll();
		});
	</script>
</head>
<body class="tree-contain">
	<!-- <div class="subnav">
		<input type="hidden" id="flag" value="0"> 
		<input type="hidden" id="storeId" value="">
				<div class="tit">
					<s></s>机构分类
				</div>
				<div class="subn-list ztree" id="js-menu"></div>
	</div>
	<label id="labBtn"></label>
	<div class="main-right"> -->
		<form id="listForm" action="list.jhtml" method="get">
		<input type="hidden" name="memberType" value="${memberType }" />
			<div class="bar">
				<div class="buttonWrap">
					[#-- <a href="javascript:void(0);" id="importButton"
						class="iconButton" onclick="member_import(this)"> <span
						class="importIcon">&nbsp;</span>${message("导入")}
					</a> <a href="javascript:;" id="export1Button"
						onclick="segmentedExport(this)" class="iconButton"> <span
						class="exportIcon">&nbsp;</span>${message("条件导出")}
					</a> --]
					<!--
			<div class="flag-wrap flagImp-wrap">
					<a href="javascript:void(0);" class="iconButton" id="export1Button">
						<span class="impIcon">&nbsp;</span>导入导出
					</a>
					<ul class="flag-list">
						<li><a href="javascript:void(0)" onclick="member_import(this)"><i class="flag-imp01"></i>${message("导入")}</a></li>
						<li><a href="javascript:void(0)" onclick="exportExcel(this)"><i class="flag-imp02"></i>${message("选择导出")}</a></li>
						<li><a href="javascript:void(0)" onclick="segmentedExport(this)"><i class="flag-imp02"></i>${message("条件导出")}</a></li>
					</ul>
				</div>
			-->
				</div>
				<div class="search-btn">
					<a href="javascript:;" id="searchBtn" class="iconButton">${message("1004")}</a>
				</div>
				<div id="searchDiv">
					<div id="search-content">
						[#if memberType==1]
						<dl>
							<dt>
								<p>${message("操作员PIN码")}:</p>
							</dt>
							<dd>
								<input type="text" class="text" id="pinCode" name="pinCode"
									btn-fun="clear" />
							</dd>
						</dl>
						[#else]
						<dl>
							<dt>
								<p>${message("16005")}:</p>
							</dt>
							<dd>
								<input type="text" class="text" id="username" name="username"
									btn-fun="clear" />
							</dd>
						</dl>
						<dl>
							<dt>
								<p>${message("16016")}:</p>
							</dt>
							<dd>
								<input type="text" class="text" id="mobile" name="mobile"
									btn-fun="clear" />
							</dd>
						</dl>
						[/#if]
						<dl>
							<dt>
								<p>${message("16006")}:</p>
							</dt>
							<dd>
								<input type="text" class="text" id="name" name="name"
									btn-fun="clear" />
							</dd>
						</dl>
						<!--
        		<dl>
					<dt><p>${message("所属客户")}:</p></dt>
					<dd>
						<span style="position:relative">
							<input name="storeId" class="text storeId" type="hidden" value="">
							<input class="text storeName" maxlength="200" type="text" value="" onkeyup="clearSelect(this)">
							<input type="button" class="iconSearch" value="" id="selectStore">
						</span>
					</dd>
				</dl>
				-->
						<!--
	    		<dl>
        			<dt><p>${message("16015")}:</p></dt>
        			<dd class="date-wrap">
						<input id="startTime" name="startTime" class="text" value="" onfocus="WdatePicker({dateFmt: 'yyyy-MM-dd',startDate:'%y-%M-%d', maxDate: '#F{$dp.$D(\'endTime\')}'});" type="text" btn-fun="clear"/>
						<div class="fl">--</div>
						<input id="endTime" name="endTime" class="text" value="" onfocus="WdatePicker({dateFmt: 'yyyy-MM-dd',startDate:'%y-%M-%d', maxDate: '#F{$dp.$D(\'endTime\')}'});" type="text" btn-fun="clear"/>
					</dd>
        		</dl>
        		-->
					</div>
				</div>
			</div>
			<div class="table-responsive">
				<table id="table-m1"></table>
				<div id="body-paginator" style="text-align: left;">
					<div id="paginator"></div>
				</div>
			</div>
		</form>
</body>
</html>